<?php
/**
 * @TODO Create file/class description
 * 
 * @category	@TODO add category
 * @package 	@TODO add package
 * @author 		Mark Tolmacs <mark.tolmacs@oghma.hu>
 * @copyright 	Redmark Kft, 2008
 * @version 	$Id$
 */
class IoC_DependencyNode {

    private $id;
    private $children;
    private $parent;

    /**
     * @param string $id the node id
     */
    public function __construct($id, $parent = NULL) {
        $this->id = $id;
        $this->parent = $parent;
        $this->children = array();
    }

    /**
     * Returns the node id.
     *
     * @return string the node id
     */
    public function getId() {
        return $this->id;
    }

    /**
     * Adds a node in the next node list.
     *
     * @param string $nextNodeId the node id to add
     */
    public function & addChild($child) {
    	$childNode = new IoC_DependencyNode($child, $this);
        if(!isset($this->children[$child])) {
            $this->children[$child] = $childNode;
        }
        
        return $childNode;
    }
    
    public function & getParent() {
    	return $this->parent;
    }
}
